package threadLearn;

/**
 * 可重入粒度测试：递归调用本方法
 * 结果：不会造成死锁
 * @author 12609
 *
 */
public class SynchronizedRecursion {
	int a = 0;
	
	public static void main(String[] args) {
		SynchronizedRecursion synchronizedRecursion = new SynchronizedRecursion();
		synchronizedRecursion.method();
	}

	private synchronized void method() {
		System.out.println(a);
		if(a == 0) {
			a++;
			method();
		}
		
	}

}
